﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  	xmlns:CustomControl="clr-namespace:ScrumTable.UI.View.WinTouch.CustomControl"
	xmlns:s="clr-namespace:Microsoft.Surface.Presentation;assembly=Microsoft.Surface.Presentation"
	xmlns:Converter="clr-namespace:ScrumTable.UI.View.Converter;assembly=ScrumTable.UI.View"
	x:Class="ScrumTable.UI.View.WinTouch.UserControls.SubControls.VelocityChart"
	x:Name="ControlRoot" >
    <UserControl.Resources>
        <Converter:WidthConverter IsCounterpart="False"  MaxValue="100" x:Key="ConverterGridHeight"></Converter:WidthConverter>
    </UserControl.Resources>
    <ItemsControl VerticalAlignment="Stretch" ItemsSource="{Binding}"  HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>

                <CustomControl:DropControl  CanDropPredicate="{Binding CanDropOnVelocity, ElementName=ControlRoot}"  s:SurfaceDragDrop.Drop="OnVelocityDrop" AllowDrop="True"  IsHitTestVisible="True" MouseDown="OnItemMouseDown" TouchDown="OnItemTouchDown" >
                    <UserControl s:SurfaceDragDrop.Drop="OnVelocityDrop" IsHitTestVisible="True" >
                         <Grid VerticalAlignment="Stretch" Background="{x:Null}" Margin="0,8,4,8" >
                                <Grid.Style>
                                    <Style TargetType="{x:Type Grid}">
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding IsSelected}" Value="true" >
                                                <Setter Property="Effect">
                                                    <Setter.Value>
                                                        <DropShadowEffect x:Name="borderDropShadowEffect" RenderingBias="Performance" BlurRadius="10"   ShadowDepth="5"  Direction="-90" Color="#55000000"  ></DropShadowEffect>
                                                    </Setter.Value>
                                                </Setter>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Grid.Style>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <Label HorizontalAlignment="Stretch" Grid.Column="0" VerticalAlignment="Stretch" Background="Green" Height="18" Padding="0" FontWeight="Bold" >
                                    <TextBlock TextTrimming="CharacterEllipsis" Text="{Binding Name}" VerticalAlignment="Center" Margin="5,0,0,0" Foreground="White" />
                                </Label>
                                <Grid VerticalAlignment="Stretch" Background="Transparent" Grid.Column="1" Height="18">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="{Binding Percent, Converter={StaticResource ConverterGridHeight}}" />
                                        <ColumnDefinition Width="{Binding PercentOpen, Converter={StaticResource ConverterGridHeight}}"/>
                                        <ColumnDefinition Width="{Binding PercentEmpty, Converter={StaticResource ConverterGridHeight}}"/>
                                    </Grid.ColumnDefinitions>
                                    <Rectangle Fill="Green" Grid.Column="0"/>
                                    <Label Foreground="White"  Grid.Column="0" FontWeight="Bold" Padding="0" VerticalContentAlignment="Center" Content="{Binding Points}" HorizontalAlignment="Center" Margin="5,0,0,0"/>
                                    <Rectangle Fill="Red" Grid.Column="1"/>
                                    <Label Foreground="White" Grid.Column="1" FontWeight="Bold" Padding="0" VerticalContentAlignment="Center" Content="{Binding PointOpen}" HorizontalAlignment="Center" Margin="5,0,0,0"/>
                                    <Rectangle Fill="White" Grid.Column="2" MinWidth="0"/>
                                    <Border Grid.ColumnSpan="3" Grid.Column="2" BorderBrush="LightGray" BorderThickness="0,1,1,1" Margin="0"/>
                                </Grid>
                            </Grid>                      
                    </UserControl>
                </CustomControl:DropControl>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
    </ItemsControl>

</UserControl>